//
//  UIBarButtonItem+Extension.swift
//  Weibo
//
//  Created by ios on 16/8/8.
//  Copyright © 2016年 ios. All rights reserved.
//

import UIKit


extension UIBarButtonItem{

    convenience init(title: String, target: AnyObject?, action: Selector) {
        self.init()
        
        let button = UIButton()
        //  添加点击事件
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        
        button.setTitle(title, forState: .Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        button.titleLabel?.font = UIFont.systemFontOfSize(15)
        button.sizeToFit()
        //  设置自定义视图
        customView = button
        
    }


}